home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Graphics / Misc / Wood.0.72 / Sources / Tree.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-08-22  |  6.1 KB  |  243 lines

  1.  
  2. #import <appkit/appkit.h>
  3. #import <soundkit/Sound.h>
  4. #import <misckit/SearchableText.h>
  5.  
  6. #import "UPath.h"
  7. #import "HitPath.h"
  8.  
  9. #define RECT_NODETYPE            0
  10. #define ROUNDRECT_NODETYPE        1
  11. #define ELLIPSE_NODETYPE        2
  12. #define RHOMB_NODETYPE            3
  13. #define HEXAGON_NODETYPE        4
  14.  
  15. #define ENDING_NONE        0
  16. #define ENDING_ARROW    1
  17. #define ENDING_HOLLOW    2
  18. #define ENDING_DOUBLE    3
  19. #define ENDING_SOLID    4
  20. #define ENDING_CIRCLE    5
  21.  
  22. #define UPDATE_NONE                0x0
  23. #define UPDATE_TREEVIEW            0x1
  24. #define UPDATE_TEXTVIEW            0x2
  25. #define CHECK_RESIZE            0x4
  26. #define SCROLL_TREEVIEW            0x8
  27. #define UPDATE_ALL        (UPDATE_TREEVIEW | UPDATE_TEXTVIEW | CHECK_RESIZE)
  28.  
  29. @protocol TreeDelegate
  30.  
  31. - updateViewsDirty:(BOOL)aBool rect:(NXRect *)aRect flag:(int)aFlag;
  32. - tree;
  33. - declareSelection:aNode;
  34. - (float)docScale;
  35. - setDocScale:(float)aScale;
  36. - currentNode;
  37. - (BOOL)showMarker;
  38. - undoManager;
  39.  
  40. @end
  41.  
  42. typedef struct _LINE {
  43.      NXCoord dx,dy;
  44.      struct _LINE *link;
  45. } Polyline;
  46.  
  47. typedef struct _POLYGON {
  48.      struct {
  49.     Polyline *head,*tail;
  50.      } lower,upper;
  51. } Polygon;
  52.  
  53. typedef struct _PROPERTIES {
  54.     NXCoord border,parentDistance;
  55.     int zipped,shadow,fill,outline;
  56.     id font;
  57.     int pathKind,linkKind;
  58.     NXColor fillColor,outlineColor,textColor,shadowColor;
  59.     float linewidth;
  60.     float biegFactor;
  61.     char *defaultNodeName;
  62.     int ending, parentEnding;
  63. } Properties;
  64.  
  65. typedef struct _DRAWSTATE {
  66.     float linewidth;
  67.     NXColor color;
  68.     id font;
  69. } DrawState;    
  70.  
  71. typedef struct _TEXTPLACER {
  72.     float rect[2];
  73.     float roundRect[3];
  74.     float ellipse[2];
  75.     float rhomb[2];
  76.     float hexagon[3];
  77. } TextPlacer;
  78.  
  79.  
  80. @interface Tree:Object
  81. {
  82.     Tree *parent,*child,*sibling;
  83.     NXCoord width,height,border,parentDistance,linewidth;
  84.     NXPoint pos,offset,deltaText,deltaLink,deltaShadow;
  85.     Polygon contour;
  86.     //BOOL zipped,updateLayout,shadow,outline,fill,selected;
  87.     int zipped,updateLayout,shadow,outline,fill,selected;
  88.     id nodeDescription;
  89.     UPath *gpath;
  90.     id delegate;
  91.     int pathKind,linkKind;
  92.     float biegFactor;
  93.     int ending, parentEnding;
  94.     NXColor fillColor,outlineColor,shadowColor;
  95.     TextPlacer placer;
  96.     NXDataLink *verknuepfung;
  97.     //BOOL hasVerknuepfung;
  98.     int hasVerknuepfung;
  99.     Sound *geraeusch;
  100.     //BOOL hasSound;
  101.     int hasSound;
  102.     TextFieldCell *textCell;
  103.     NXRect textCellFrame;
  104.     unsigned dgVertexNr[4], dgSymbolNr;
  105. }
  106.  
  107. // creating and destroying
  108. - initLabel:(const char *)aLabel props:(Properties *)aProps;
  109. - free;
  110. - copyFromZone:(NXZone *)zone;
  111.  
  112. // layout and drawing
  113. - involved:(const NXRect *)aRect addTo:aList link:aPath;
  114. - getBounds:(NXRect *)rect;
  115. - getTreeBounds:(NXRect *)rect 
  116.   lowerWidth:(NXCoord *)lowW lowerHeight:(NXCoord *)lowH;
  117. - hit:(HitPath *)hitUPath;
  118. - hitAttachment:(const NXPoint *)aPoint :(BOOL *)theAttach;
  119. - activateAttachment:(NXEvent *)event inView:aView;
  120. - activateSound:(NXEvent *)event inView:aView;
  121. - drawNodeShadow:(DrawState *)aState;
  122. - drawNodeFill:(DrawState *)aState;
  123. - drawNodeOutline:(DrawState *)aState knobs:(BOOL)aBool;
  124. - drawNodeEnding:(DrawState *)aState;
  125. - drawNodeCellsInView:aView attachments:(BOOL)aBool;
  126. - setOffset:(NXCoord)aX :(NXCoord)aY;
  127. - (NXCoord)width;
  128. - (NXCoord)height;
  129. - (Polygon *)contour;
  130. - layout;
  131. - getTextFrame:(NXRect *)aRect;
  132.  
  133. // tree data structure manipulation
  134. - sibling;
  135. - child;
  136. - parent;
  137. - addTree:(Tree *)aTree;
  138. - removeChild:(Tree *)aChild;
  139. - insertTree:(Tree *)aTree at:(int)aPos;
  140.  
  141. //properties
  142. - attachFile:(const char *)aFileName;
  143. - breakAttachment;
  144. - (BOOL)attached;
  145. - attachSound:(const char *)aSoundName;
  146. - breakSound;
  147. - (BOOL)hasSound;
  148. - attachedSound;
  149. - setSound:aSound;
  150. - applyStyleToSubtree;
  151. - promoteProps:(Properties *)aProps;
  152. - getProps:(Properties *)aProps;
  153. - changeTo:(Properties *)aProps;
  154.  
  155. // tree properties
  156. - (NXCoord)border;
  157. - setBorder:(NXCoord)aBorder;
  158. - (NXCoord)parentDistance;
  159. - setParentDistance:(NXCoord)aParentDistance;
  160. - (BOOL)shadow;
  161. - setShadow:(BOOL)aShadow;
  162. - (int)linkKind;
  163. - setLinkKind:(int)aLinkKind;
  164. - changeLinkKind;
  165. - (float)biegFactor;
  166. - setBiegFactor:(float)aBiegFactor;
  167. - (NXColor)shadowColor;
  168. - setShadowColor:(NXColor)aColor;
  169.  
  170. // node properties
  171. - (const char *)label;
  172. - setLabel:(const char *)aLabel;
  173. - setRTFDescription:(const char *)aDescription;
  174. - setDescription:(const char *)aDescription;
  175. - changeDescriptionFrom:aTextView;
  176. - putDescriptionIn:aTextView;
  177. - (int)pathKind;
  178. - setPathKind:(int)aPathKind;
  179. - (BOOL)outline;
  180. - setOutline:(BOOL)aOutline;
  181. - font;
  182. - changeFont:sender;
  183. - (NXColor)fillColor;
  184. - setFillColor:(NXColor)aColor;
  185. - (NXColor)outlineColor;
  186. - setOutlineColor:(NXColor)aColor;
  187. - (NXColor)textColor;
  188. - setTextColor:(NXColor)aColor;
  189. - (float)linewidth;
  190. - setLinewidth:(float)aLinewidth;
  191. - (BOOL)zipped;
  192. - changeZipped;
  193. - (int)ending;
  194. - setEnding:(int)aEnding;
  195. - (int)parentEnding;
  196. - setParentEnding:(int)aEnding;
  197.  
  198. // misc
  199. - (BOOL)selected;
  200. - setSelected:(BOOL)aBOOL;
  201. - setUpdateLayout:(BOOL)aBool;
  202. - positionFrom:(const NXPoint *)aPoint;
  203. - setPositionTo:(const NXPoint *)aPoint;
  204. - linkPoint:(NXPoint *)aPoint;
  205. - linkParentPoint:(NXPoint *)aPoint;
  206. - linkChildPoint:(NXPoint *)aPoint;
  207. - delegate;
  208. - setDelegate:aDelegate;
  209. - setDelegateRecursive:aDelegate;
  210. - textDidEnd:textObject endChar:(unsigned short)endChar;
  211.  
  212. // streaming to diagram2 format
  213. - (unsigned)dgSymbolNr;
  214. - dgWriteSymbol:(NXStream *)stream buffer:(char *)buffer filename:(const char *)aName;
  215. - dgWriteVertex:(NXStream *)stream buffer:(char *)buffer;
  216. - dgWriteLine:(NXStream *)stream buffer:(char *)buffer;
  217. + saveToD2Tree:aTree fromView:aView toFile:(const char *)aFile printInfo:aPrintInfo;
  218. + (unsigned)dgNextNr;
  219.  
  220. // streaming 
  221. - writeStyleToPBStream:(NXTypedStream *)stream;
  222. - readStyleFromPBStream:(NXTypedStream *)stream;
  223. - writeToPBStream:(NXTypedStream *)stream;
  224. - writeToMMAPB:(NXStream *)stream; 
  225. - write:(NXTypedStream *)stream;
  226. - read:(NXTypedStream *)stream;
  227. - awake;
  228.  
  229. // SearchableText support
  230. - searchTreeFor:(const char *)pattern untilNode:endNode 
  231.   reverse:(BOOL)rev regexpr:(BOOL)regexpr cases:(BOOL)cases position:(int *)positionS size:(int *)sizeS;
  232. - replaceTreeFor:(const char *)pattern with:(const char *)replacement untilNode:endNode 
  233.   regexpr:(BOOL)regexpr cases:(BOOL)cases result:(int *)result;    
  234. - nextInDepth;
  235. - previousInDepth;
  236. - lastInDepth;
  237. - (BOOL)replaceLabelSelectionWith:(const char *)replacement pos:(int)aPos size:(int)aSize;
  238.   
  239. @end
  240.  
  241.  
  242.  
  243.